<?php

class Zend_View_Helper_ValidateDojoForm extends Zend_View_Helper_Abstract { 

    public function validateDojoForm($id_form) {
    	$this->view->headScript()->captureStart(); ?>
        function validateDojoForm() {
            var form = dijit.byId("<?php echo $id_form; ?>");
            if (!form.validate()) {
                return false;
            }
            return true;
        }
        dojo.addOnLoad(function () {
            dojo.connect(dijit.byId("<?php echo $id_form; ?>"),
                         "onSubmit",
                         "validateDojoForm");
        });
<?php $this->view->headScript()->captureEnd();
    }
}